package com.cbts.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
 * TravelStandard entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "travel_standard", catalog = "cbts", uniqueConstraints = @UniqueConstraint(columnNames = "grade"))
public class TravelStandard implements java.io.Serializable {

	// Fields

	private Integer standardId;
	private Traffic traffic;
	private Hotel hotel;
	private String grade;
	private Double mealsCost;
	private Double elseCost;
	private Set<BusinessTravel> businessTravels = new HashSet<BusinessTravel>(0);
	private Set<UserGroup> userGroups = new HashSet<UserGroup>(0);

	// Constructors

	/** default constructor */
	public TravelStandard() {
		mealsCost=0.00;
		elseCost=0.00;
	}

	/** minimal constructor */
	public TravelStandard(Integer standardId, Traffic traffic, Hotel hotel,
			String grade, Double mealsCost, Double elseCost) {
		this.standardId = standardId;
		this.traffic = traffic;
		this.hotel = hotel;
		this.grade = grade;
		this.mealsCost = mealsCost;
		this.elseCost = elseCost;
	}

	/** full constructor */
	public TravelStandard(Integer standardId, Traffic traffic, Hotel hotel,
			String grade, Double mealsCost, Double elseCost,
			Set<BusinessTravel> businessTravels, Set<UserGroup> userGroups) {
		this.standardId = standardId;
		this.traffic = traffic;
		this.hotel = hotel;
		this.grade = grade;
		this.mealsCost = mealsCost;
		this.elseCost = elseCost;
		this.businessTravels = businessTravels;
		this.userGroups = userGroups;
	}

	// Property accessors
	@Id
	@Column(name = "standardId", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY) 
	public Integer getStandardId() {
		return this.standardId;
	}

	public void setStandardId(Integer standardId) {
		this.standardId = standardId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "trafficId", nullable = false)
	public Traffic getTraffic() {
		return this.traffic;
	}

	public void setTraffic(Traffic traffic) {
		this.traffic = traffic;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "hotelId", nullable = false)
	public Hotel getHotel() {
		return this.hotel;
	}

	public void setHotel(Hotel hotel) {
		this.hotel = hotel;
	}

	@Column(name = "grade", unique = true, nullable = false, length = 25)
	public String getGrade() {
		return this.grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	@Column(name = "mealsCost", nullable = false, precision = 11)
	public Double getMealsCost() {
		return this.mealsCost;
	}

	public void setMealsCost(Double mealsCost) {
		this.mealsCost = mealsCost;
	}

	@Column(name = "elseCost", nullable = false, precision = 11)
	public Double getElseCost() {
		return this.elseCost;
	}

	public void setElseCost(Double elseCost) {
		this.elseCost = elseCost;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "travelStandard")
	public Set<BusinessTravel> getBusinessTravels() {
		return this.businessTravels;
	}

	public void setBusinessTravels(Set<BusinessTravel> businessTravels) {
		this.businessTravels = businessTravels;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "travelStandard")
	public Set<UserGroup> getUserGroups() {
		return this.userGroups;
	}

	public void setUserGroups(Set<UserGroup> userGroups) {
		this.userGroups = userGroups;
	}

}